Skip to content

fix: detect relocated uv and pipx tool installations - #5103

Open
Shubham-Padkonde wants to merge 4 commits into
github:mainfrom
Shubham-Padkonde:fix/5095-detect-relocated-tool-installs
Open

Shubham-Padkonde wants to merge 4 commits into
github:mainfrom
Shubham-Padkonde:fix/5095-detect-relocated-tool-installs

Conversation

@Shubham-Padkonde

@Shubham-Padkonde Shubham-Padkonde commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #5095. specify self upgrade classifies valid uv/pipx installations outside the old hard-coded folders as unsupported. Detect relocated tool environments through UV_TOOL_DIR, PIPX_HOME, XDG data locations, and platform defaults while retaining legacy paths.

The review fixes also recognize uv's current %APPDATA%/uv/tools and legacy macOS ~/Library/Application Support/uv/tools directories. Expand a literal tilde after substituting environment variables, and resolve relative PIPX_HOME and UV_TOOL_DIR values against the working directory, as their installers do. Unset/empty/unresolved-variable guards, path-component boundaries, and registry fallback restrictions remain intact. Relative XDG paths are still rejected.

The upgrade guide explains that relocation variables must remain set when running the installer. Ephemeral uvx detection and copied Windows entrypoint shims outside the tool environment are outside this path-detection change.

Validation

Windows, Python 3.14.6, using this checkout's own virtualenv:

  • python -m pytest tests/specify_cli/test_version_detection.py tests/specify_cli/test_version_execution.py tests/specify_cli/test_version_guidance.py tests/specify_cli/test_version_verification.py tests/specify_cli/test_version_release.py tests/specify_cli/selfs/test_command_upgrade.py -q: 175 passed, 4 skipped.

  • Four new review regressions fail at the preceding PR commit: the two uv layouts and PIPX_HOME=./pipx-home / ../pipx-home. All pass after the fix. Sibling-directory negative controls pass before and after. The original change had twelve failing layout regressions on base.

  • Installed the patched package using pipx into an isolated relative PIPX_HOME; its real environment entrypoint detects pipx during self upgrade --dry-run --tag v1.2.3. No upgrade was executed. pipx's copied external Windows shim remains unrecognized, as noted above.

  • The latest two UV_TOOL_DIR=./tools / ../tools regressions fail on the preceding PR commit and pass after this fix. Sibling-directory controls and relative XDG rejection pass. An isolated non-editable uv tool install with a relative UV_TOOL_DIR detects uv tool through the real installed executable during self upgrade --dry-run; no upgrade was executed.

  • CLI help and git diff --check pass. Ruff reports the same seven existing findings on base and head, with no added findings.

  • macOS/Linux folder layouts are fixtures on Windows, not native installations. The full repository suite was not run.

AI Disclosure

  • I did not use AI assistance for this contribution

  • I did use AI assistance

OpenAI Codex (GPT-6), operating autonomously on behalf of Shubham-Padkonde, investigated the issue and review feedback, wrote code/tests/documentation, ran validation, and drafted this description. The exact model variant/reasoning setting is not exposed to the agent. No personal line-by-line human review is claimed. Agent-authored commits identify assistance in their trailers.

Assisted-by: Codex (model: GPT-6, autonomous)
@mnriem mnriem added the triage-must-have Verdict: high-value, important work for Spec Kit — do first label Oct 25, 2026
@mnriem
mnriem requested a max review from Copilot October 26, 2026 13:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A verified gap in tilde-prefixed PIPX_HOME handling still prevents valid relocated installations from being upgraded.

1 open issue
What changed in this PR

Extends Specify CLI’s install detection so specify self upgrade can recognize relocated uv and pipx installations, targeting the problem reported in #5095.

Changes:

  • Adds relocation variables and current platform defaults while retaining legacy paths.
  • Adds regression cases for supported layouts, sibling-directory rejection, and unset or empty variables.
  • Documents the environment settings needed when upgrading relocated installations.
File Description
tests/​specify_cli/​test_version_detection.py Adds positive and negative relocation-detection cases.
src/​specify_cli/​_version.py Expands installer prefixes and ignores unconfigured directory variables.
docs/​upgrade.md Explains relocation support and required environment settings.

Review effort: Max

Comment thread src/specify_cli/_version.py
@mnriem

mnriem commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Please address Copilot feedback

@mnriem mnriem added the author-awaiting Waiting on author response label Oct 26, 2026
Assisted-by: Codex (model: GPT-6, autonomous)
@mnriem
mnriem requested a max review from Copilot October 26, 2026 16:31
@mnriem mnriem removed the author-awaiting Waiting on author response label Oct 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Valid installation configurations still fall through to unsupported detection.

2 open issues
1 resolved since last review

Review effort: Max

Comment thread src/specify_cli/_version.py
Comment thread src/specify_cli/_version.py
@mnriem

mnriem commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Please address Copilot feedback

@mnriem mnriem added the author-awaiting Waiting on author response label Oct 26, 2026
Preserve path boundaries and unset-variable guards while resolving
PIPX_HOME against the installer working directory. Add current Windows
and legacy macOS uv layouts with positive and sibling-path regressions.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
@mnriem
mnriem requested a max review from Copilot October 27, 2026 18:01
@mnriem mnriem removed the author-awaiting Waiting on author response label Oct 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Relative UV_TOOL_DIR installations are still misclassified as unsupported.

1 open issue
2 resolved since last review

Review effort: Max

Comment thread src/specify_cli/_version.py Outdated
Resolve UV_TOOL_DIR against the working directory while preserving sibling boundaries and rejecting relative XDG_DATA_HOME prefixes.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed for an unpublished path-handling finding that can misidentify existing installations and bypass relative-path validation.

No open issues 🎉

1 resolved since last review

Review effort: Max

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-must-have Verdict: high-value, important work for Spec Kit — do first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: specify self upgrade reports "unsupported" for uv tool installs under XDG_DATA_HOME (and likely for current pipx installs)

3 participants